home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cc / sprite / specs.h.rab < prev    next >
Encoding:
Text File  |  1990-04-13  |  10.9 KB  |  303 lines

  1. /*
  2.  * specs.h --
  3.  *
  4.  *    This file is included by gcc.c, and defines the compilation
  5.  *    and linking specs for each of the target machines for which
  6.  *    gcc can currently generate code.
  7.  *
  8.  * Copyright 1988 Regents of the University of California
  9.  * Permission to use, copy, modify, and distribute this
  10.  * software and its documentation for any purpose and without
  11.  * fee is hereby granted, provided that the above copyright
  12.  * notice appear in all copies.  The University of California
  13.  * makes no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without
  15.  * express or implied warranty.
  16.  *
  17.  * $Header: /sprite/src/cmds/cc/sprite/RCS/specs.h,v 1.13 90/04/09 08:45:24 rab Exp Locker: rab $ SPRITE (Berkeley)
  18.  */
  19.  
  20. #ifndef _SPECS
  21. #define _SPECS
  22.  
  23. /* This structure says how to run one compiler, and when to do so.  */
  24.  
  25. struct compiler
  26. {
  27.   char *suffix;            /* Use this compiler for input files
  28.                    whose names end in this suffix.  */
  29.   char *spec;            /* To use this compiler, pass this spec
  30.                    to do_spec.  */
  31. };
  32.  
  33. /*
  34.  * One of the following structures exists for each machine for
  35.  * which gcc can generate code.  It gives all the spec-related
  36.  * information for compiling for tha target.
  37.  */
  38.  
  39. typedef struct
  40. {
  41.     char *name;                /* Official name of this target
  42.                      * machine (many -m switches may
  43.                      * map to the same entry). */
  44.     struct compiler *base_specs;    /* List of specs to use when compiling
  45.                      * for this target machine.  Last
  46.                      * compiler must be all zeros to
  47.                      * indicate end of list. */
  48.     struct compiler *cplusplus_specs;   /* List of specs to use when invoked                               as a c++ compiler */
  49.     char *link_base_spec;        /* Basic spec to use to link for this
  50.                      * target. */
  51.     char *cpp_predefines;        /* Spec to substitute for %p. */
  52.     char *cpp_spec;            /* Spec to substitute for %C. */
  53.     char *cc1_spec;                     /* Spec to substitute for %1. */
  54.     char *cplus1_spec;                  /* Spec to substitute for %+  */
  55.     char *asm_spec;            /* Spec to substitute for %a. */
  56.     char *link_spec;            /* Spec to substitute for %l. */
  57.     char *lib_spec;            /* Spec to substitute for %L. */
  58.     char *startfile_spec;        /* Spec to substitute for %S. */
  59.     char *signed_char_spec;             /* Spec to substitute for %c. */
  60. } target_specs;
  61.  
  62. static char default_assembler_string[] = 
  63.      "%{!E:%{!S:%a %{R} %{j} %{J} %{h} %{d2}\
  64.     %i %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}\
  65.       %{E:%C %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} -m%m %{M*} %{T} \
  66.         -undef -D__GNUC__ %{ansi: -$ -D__STRICT_ANSI__}\
  67.     %{!ansi:%p -Dunix -Dsprite}\
  68.         %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  69.     %{Wcomment} %{Wtrigraphs} %{Wall}\
  70.         %i %{o*} %{M*:%{o*}}}\n";
  71.  
  72. static char default_c_string[] =
  73.      "%C %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} -m%m %{M*} %{T} \
  74.         -undef -D__GNUC__ %{ansi: -$ -D__STRICT_ANSI__}\
  75.     %{!ansi:%p -Dunix -Dsprite}\
  76.     %{!msoft-float:-D__SOFT_FLOAT__}\
  77.         %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  78.     %{Wcomment} %{Wtrigraphs} %{Wall}\
  79.         %i %{!M*:%{!E:%g.cpp}}%{E:%{o*}}%{M*:%{o*}}\n\
  80.      %{!M*:%{!E:%1 %g.cpp %{!Q:-quiet} -dumpbase %i %{Y*} %{d*} %{m*} %{f*}\
  81.     %{a} %{g} %{O} %{W*} %{w} %{pedantic} %{ansi} %{traditional}\
  82.     %{v:-version} %{gg:-symout %g.sym} %{pg:-p} %{p}\
  83.         %{S:%{o*}%{!o*:-o %b.s}}%{!S:-o %g.s}\n\
  84.      %{!S:%a %{R} %{j} %{J} %{h} %{d2} %{gg:-G %g.sym}\
  85.     %g.s %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}}";
  86.  
  87. static char default_cplusplus_string[] = 
  88.     "%C %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} \
  89.        -I/sprite/lib/include/g++ -m%m %{M*} %{T} \
  90.        -undef -D__GNUC__ -D__GNUG__ -D__cplusplus %p %P\
  91.        %c %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  92.        %{Wcomment*} %{Wtrigraphs} %{Wall}\
  93.        %i %{!M*:%{!E:%{!pipe:%g.cpp}}}%{E:%{o*}}%{M*:%{o*}} |\n\
  94.      %{!M*:%{!E:%+ %g.cpp %{!Q:-quiet} -dumpbase %i %{Y*} %{d*} %{m*} %{f*}\
  95.     %{a} %{g} %{O} %{W*} %{w} %{pedantic} %{ansi} %{traditional}\
  96.     %{v:-version} %{gg:-symout %g.sym} %{pg:-p} %{p}\
  97.         %{S:%{o*}%{!o*:-o %b.s}}%{!S:-o %g.s}\n\
  98.      %{!S:%a %{R} %{j} %{J} %{h} %{d2} %{gg:-G %g.sym}\
  99.     %g.s %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}}";
  100.  
  101. /*
  102.  * Spec information for individual machines:
  103.  */
  104.  
  105. static struct compiler default_compilers[] =
  106. {
  107.     {".c", default_c_string },
  108.     {".cc", default_cplusplus_string },
  109.     {".s", default_assembler_string },
  110.     /* Mark end of table. */
  111.     {0, 0}
  112. };
  113.  
  114. static struct compiler default_cplusplus[] =
  115. {
  116.     {".c", default_cplusplus_string },
  117.     {".s", default_assembler_string },
  118.     /* Mark end of table. */
  119.     {0, 0},
  120. };
  121.  
  122. #if 0
  123. static struct compiler sun3_compilers[] =
  124. {
  125.     {".c",
  126.      "%C %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} -m%m %{M*} %{T} \
  127.         -undef -D__GNUC__ %{ansi: -$ -D__STRICT_ANSI__}\
  128.     %{!ansi:%p -Dunix -Dsprite}\
  129.     %{!m68881:-D__SOFT_FLOAT__}\
  130.         %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  131.     %{Wcomment} %{Wtrigraphs} %{Wall}\
  132.         %i %{!M*:%{!E:%g.cpp}}%{E:%{o*}}%{M*:%{o*}}\n\
  133.      %{!M*:%{!E:%1 %g.cpp %{!Q:-quiet} -dumpbase %i %{Y*} %{d*} %{m*} %{f*}\
  134.     %{a} %{g} %{O} %{W*} %{w} %{pedantic} %{ansi} %{traditional}\
  135.     %{v:-version} %{gg:-symout %g.sym} %{pg:-p} %{p}\
  136.     %{!m68881:-msoft-float}\
  137.         %{S:%{o*}%{!o*:-o %b.s}}%{!S:-o %g.s}\n\
  138.      %{!S:%a %{R} %{j} %{J} %{h} %{d2} %{gg:-G %g.sym}\
  139.     %g.s %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}}"},
  140.     {".s",
  141.      "%{!E:%{!S:%a %{R} %{j} %{J} %{h} %{d2}\
  142.     %i %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}\
  143.       %{E:%C %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} -m%m %{M*} %{T} \
  144.         -undef -D__GNUC__ %{ansi: -$ -D__STRICT_ANSI__}\
  145.     %{!ansi:%p -Dunix -Dsprite}\
  146.         %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  147.     %{Wcomment} %{Wtrigraphs} %{Wall}\
  148.         %i %{o*} %{M*:%{o*}}}\n"},
  149.     /* Mark end of table. */
  150.     {0, 0}
  151. };
  152. #endif
  153.  
  154. static char default_link_spec[] =
  155.     "%{!c:%{!M*:%{!E:%{!S:%l %{o*}\
  156.     %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
  157.     %{y*} %{!nostdlib:%S} %{L*} -L/sprite/lib/%m.md \
  158.     %o %{!nostdlib:%L}\n }}}}";
  159.  
  160.  
  161. static target_specs m68000_target =
  162. {
  163.     "sun2",                    /* name */
  164.     default_compilers,                /* base_specs */
  165.     default_cplusplus,                          /* c++ specs */
  166.     default_link_spec,                /* link_base_spec */
  167.     "-Dmc68000 -Dsun2",                /* cpp_predefines */
  168.     "cpp",                                      /* cpp_spec */
  169.     "cc1.68k -msoft-float -m68000",        /* cc1_spec */
  170.     "g++1.68k -m68000",                   /* cplus1_spec */
  171.     "as.sun3 -m68010",                /* asm_spec */
  172.     "ld.sun3 -X -m68010 %{!e:-e start}",    /* link_spec */
  173.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  174.     "",                        /* start_file_spec */
  175.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char_spec */
  176. };
  177.  
  178. static target_specs m68020_target =
  179. {
  180.     "sun3",                    /* name */
  181.     default_compilers,                /* base_specs */
  182.     default_cplusplus,                          /* c++ specs */
  183.     default_link_spec,                /* link_base_spec */
  184.     "-Dmc68000 -Dsun3",                /* cpp_predefines */
  185.     "cpp",                                      /* cpp_spec */
  186.     "cc1.68k -m68020",                          /* cc1_spec */
  187.     "g++1.68k -m68020",                          /* cplus1_spec */
  188.     "as.sun3 -m68020",                /* asm_spec */
  189.     "ld.sun3 -X %{!e:%{!pg:-e start}%{pg:-e gstart}}",
  190.                         /* link_spec */    
  191.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  192.     "",                        /* start_file_spec */
  193.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char spec */
  194. };
  195.  
  196. static target_specs spur_target =
  197. {
  198.     "spur",                    /* name */
  199.     default_compilers,                /* base_specs */
  200.     default_cplusplus,                          /* c++ specs */
  201.     default_link_spec,                /* link_base_spec */
  202.     "-Dspur",                    /* cpp_predefines */
  203.     "cpp",                                      /* cpp_spec */
  204.     "cc1.spur -msoft-float",            /* cc1_spec */
  205.     "g++1.spur -msoft-float",                    /* cplus1_spec */
  206.     "sas",                    /* asm_spec */
  207.     "sld -X -p %{!e:-e start}",            /* link_spec */
  208.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  209.     "",                        /* start_file_spec */
  210.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char spec */
  211. };
  212.  
  213. static target_specs sparc_target =
  214. {
  215.     "sun4",                    /* name */
  216.     default_compilers,                /* base_specs */
  217.     default_cplusplus,                          /* c++ specs */
  218.     default_link_spec,                /* link_base_spec */
  219.     "-Dsparc -Dsun4",                /* cpp_predefines */
  220.     "cpp",                                      /* cpp_spec */
  221.     "cc1.sparc",                        /* cc1_spec */
  222.     "g++1.sparc",                                /* cplus1_spec */
  223.     "as.sun4",                         /* asm_spec */
  224.     "ld.sun4 -X %{!e:%{!pg:-e start}%{pg:-e gstart}}",
  225.                         /* link_spec */
  226.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  227.     "",                        /* start_file_spec */
  228.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char spec */
  229. };
  230.  
  231.  
  232. static target_specs mips_target =
  233. {
  234.     "ds3100",                    /* name */
  235.     default_compilers,                /* base_specs */
  236.     default_cplusplus,                          /* c++ specs */
  237.     default_link_spec,                /* link_base_spec */
  238.     "-Dmips -Dds3100",                /* cpp_predefines */
  239.     "cpp",                                      /* cpp_spec */
  240.     "cc1.mips",                         /* cc1_spec */
  241.     "g++1.mips",                                 /* cplus1_spec */
  242. #if 0
  243.     "as.ds3100",                /* asm_spec */
  244.     "ld.ds3100 -X %{!e:%{!pg:-e start}%{pg:-e gstart}}",
  245.                         /* link_spec */
  246. #else
  247.     /* 
  248.      *    For now we have to use the Ultrix assembler and linker.
  249.      *    These will fail on a sun.
  250.      */
  251. #ifdef ds3100
  252.     "/sprite/cmds.ds3100/as",
  253.     "/sprite/cmds.ds3100/ld -B1.31 /usr/lib/crt0.o1.31",
  254. #else
  255.     "echo YOU CANT ASSEMBLE FOR THE DS3100 ON THIS MACHINE",
  256.     "echo YOU CANT LINK FOR THE DS3100 ON THIS MACHINE",
  257. #endif
  258. #endif
  259.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  260.     "",                        /* start_file_spec */
  261.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char spec */
  262. };
  263.  
  264. /*
  265.  * Top-level table used to look up information for a particular target
  266.  * machine.  The first entry will be used as the default target if
  267.  * a target isn't specified in a command-line switch or environment
  268.  * variable.
  269.  */
  270.  
  271. typedef struct
  272. {
  273.     char *name;            /* Name of target machine (as it
  274.                  * appears in "-m" switch. */
  275.     target_specs *info;        /* Information about target machine. */
  276. } target_machine;
  277.  
  278. static target_machine target_machines[] = {
  279.     {"sun3",    &m68020_target},    /* This is the default target. */
  280.     {"68000",    &m68000_target},
  281.     {"68010",    &m68000_target},
  282.     {"sun2",    &m68000_target},
  283.     {"68020",    &m68020_target},
  284.     {"spur",    &spur_target},
  285.     {"sun4",    &sparc_target},
  286.     {"sun4c",   &sparc_target},
  287.     {"sparc",   &sparc_target},
  288.     {"ds3100",  &mips_target},
  289.     {"mips",    &mips_target},
  290.     {0, 0}                /* Zeroes mark end of list. */
  291. };
  292.  
  293. static char *target_name;        /* Name of selected target. */
  294. static target_specs *target;        /* Info for selected target. */
  295.  
  296. /*
  297.  *  Put temporary files in /tmp
  298.  */
  299. #define P_tmpdir    "/tmp"
  300.  
  301. #endif /* _SPECS */
  302.  
  303.